package com.example.lanouhn.firstapp.activity.utils;

import com.alibaba.fastjson.JSON;
import com.example.lanouhn.firstapp.activity.model.PersonCenter;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 个人中心的解析
 */
public class PersonCenterJson {

    public static PersonCenter getPersonCenter(String json){

        PersonCenter personCenter = new PersonCenter();

        try {
            JSONObject job  = new JSONObject(json);
            //获取解析数据
            String data = job.getString("datas");

            JSONObject jsonObject = new JSONObject(data);
            JSONObject j = jsonObject.getJSONObject("member_info");

            //使用fast解析
            personCenter = JSON.parseObject(j.toString(),PersonCenter.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return personCenter;
    }



}
